<template>
  <div class='container'>
      <!-- 对话话框 -->
    <el-dialog
      title="提示"
      :visible="addDialogVisible"
      width="20%"
      @close= 'onClose'
     >
     <el-form ref="form" :model="directorysForm" :rules="rules" label-width="90px">
        <el-form-item v-if="!subjects.id && !subjects.name" label="所属学科" prop="value">
          <el-select v-model="directorysForm.subjectID" placeholder="请选择">
            <el-option v-for="item in tableData" :key="item.id" :label="item.subjectName" :value="item.subjectID"></el-option>
          </el-select>
        </el-form-item>
          <el-form-item label="目录名称" prop="directoryName">
          <el-input v-model="directorysForm.directoryName" placeholder="请输入目录名称"></el-input>
        </el-form-item>
     </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="onClose">取 消</el-button>
        <el-button type="primary" @click="determine">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    addDialogVisible: {
      type: Boolean,
      required: true
    }
  },
  data () {
    return {
      directorysForm: {

      },
      rules: {
        directoryName: [
          { required: true, message: '请输入目录名称', trigger: 'blur' },
          { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
        ],
        value: [{ required: true, message: '请选择所属学科', trigger: 'blur' }]
      }
    }
  },
  created () {

  },
  methods: {
    onClose () {
      this.$emit('update:set-role-dialog', false)
      console.log(this.addDialogVisible)
    }

  }
}
</script>

<style scoped lang='less'>

</style>
